"""用来根据用户方案设计，将新建方案写入本地"""
import pickle
import data
import data_struct
import os

def Write_TXT(Name,Path,Data):
    """

    :param Path: 写入路径

    """
    #Data=data_struct.Write_Data(CLEAR_ALL_STD,WATERCOLOR_PEN_STD)#这个方案特有的数据
    file=open(Path+Name+".txt",'wb')
    pickle.dump(Data,file)
    file.close()

def Read_TXT(Name,Path):
    file=open(Path+Name+".txt",'rb')
    Data=pickle.load(file)#这个方案特有的数据
    Update_data(Data)
    file.close()

def Update_data(Data):
    """根据所给方案数据更改data"""
    data.WATERCOLOR_PEN_STD=Data.WATERCOLOR_PEN_STD
    data.CLEAR_ALL_STD=Data.CLEAR_ALL_STD
    print("data.CLEAR_ALL_STD",data.CLEAR_ALL_STD)
    print("data.WATERCOLOR_PEN_STD",data.WATERCOLOR_PEN_STD)

if __name__ == '__main__':
    # CLEAR_ALL_STD = [0.0, 0.12283387849758491, 0.26019449671798833, 0.3779263520139143, 0.4763893720112332, 0.38307958089528354, 0.5066763914440922, 0.4296602787404517, 0.3420077245024138, 0.36, 0.45162844014265313, 0.3404699782162136, 0.24712447543585175, 0.3347332125856561, 0.4308410032362757, 0.3324047348842124, 0.24934770154822167, 0.30597576502391693, 0.42184153956753057, 0.494890982176283, 0.5697266262204971]
    # WATERCOLOR_PEN_STD = []
    #
    # Write_TXT("PLAN1","F:\\project\\Gesture_rec\\PPT_PLAN\\",CLEAR_ALL_STD,WATERCOLOR_PEN_STD)
    # Write_TXT("PLAN2", "F:\\project\\Gesture_rec\\PPT_PLAN\\", [], [])
    #Read_TXT("PLAN1","F:\\project\\Gesture_rec\\PPT_PLAN\\")
    #Write_TXT("PLAN7","F:\\project\\Gesture_rec\\PPT_PLAN\\",CLEAR_ALL_STD,WATERCOLOR_PEN_STD)
    #Read_TXT("PLAN7", "F:\\project\\Gesture_rec\\PPT_PLAN\\")

    file = open("F:\\project\\Gesture_rec\\PPT_PLAN\\" + "plan11" + ".txt", 'rb')
    Data = pickle.load(file)
    Data.print_Data()